home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / Game.EXE_01_2001.iso / demos / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / Damage.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-11-16  |  35.9 KB  |  1,091 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Reference
  5. import Bladex
  6. import copy
  7. import pdb
  8. import Blood
  9. import CharStats
  10. import Breakings
  11. import whrandom
  12. import Actions
  13. import netgame
  14. import Auras
  15. import GenFX
  16. if netgame.GetNetState() != 0:
  17.     import NetWeapon
  18.  
  19. PlayerHitFunc = ''
  20. PrintFormula = 0
  21. PrintFatigue = 0
  22. InflictDamageFXData = { }
  23. InflictDamageFXData['Kgt_g_27kata_new'] = (250.0, 0.7, 240, 20, 0, 2.0, None, 1.0, 1.0)
  24. AnimationData = { }
  25. AnimationData['Bar_g2h_08'] = 1.0
  26. AnimationData['Bar_g2h_b6kata'] = 1.25
  27. AnimationData['Bar_g2h_b7'] = 2.8
  28. AnimationData['Bar_g2h_s7'] = 1.0
  29. AnimationData['Bar_g2h_02kata'] = 1.2
  30. AnimationData['Bar_g2h_11'] = 1.0
  31. AnimationData['Bar_g2h_01'] = 1.8
  32. AnimationData['Bar_g2h_12low'] = 1.0
  33. AnimationData['Bar_g2h_02low'] = 2.0
  34. AnimationData['Bar_g2h_b6low'] = 8.0
  35. AnimationData['Bar_g2h_b6'] = 8.0
  36. AnimationData['Bar_g2h_b29'] = 10.0
  37. AnimationData['Bar_g2h_s7'] = 1.0
  38. AnimationData['Bar_g2h_19'] = 10.0
  39. AnimationData['Bar_g2h_13'] = 7.0
  40. AnimationData['Bar_g2h_s8'] = 7.0
  41. AnimationData['Bar_g2h_26'] = 10.0
  42. AnimationData['Bar_g2h_28'] = 10.0
  43. AnimationData['Bar_g2h_17'] = 10.0
  44. AnimationData['Bar_g2h_b7'] = 10.0
  45. AnimationData['Bar_g2h_21_7'] = 8.0
  46. AnimationData['Bar_g2h_21_2'] = 21.0
  47. AnimationData['Bar_g2h_earthpow'] = 60.0
  48. AnimationData['Bar_g2h_21_6kata'] = 3.0
  49. AnimationData['Bar_g2h_26_b6'] = 3.5
  50. AnimationData['Bar_g2h_02'] = 10.0
  51. AnimationData['Bar_g_axe08'] = 1.0
  52. AnimationData['Bar_g_axe18'] = 1.0
  53. AnimationData['Bar_g_axe01'] = 2.6
  54. AnimationData['Bar_g_axe02'] = 1.0
  55. AnimationData['Bar_g_axe13'] = 1.0
  56. AnimationData['Bar_g_axe111'] = 1.0
  57. AnimationData['Bar_g_axe_2katab6low'] = 30.0
  58. AnimationData['Bar_g_axe31'] = 3.2
  59. AnimationData['Bar_g_axe32'] = 9.0
  60. AnimationData['Bar_g_axe_26kata'] = 9.0
  61. AnimationData['Bar_g_axe_3s2'] = 9.0
  62. AnimationData['Bar_g_axe211'] = 10.0
  63. AnimationData['Bar_g_axe33'] = 7.0
  64. AnimationData['Bar_g_axe12'] = 10.0
  65. AnimationData['Bar_g_axe34'] = 8.0
  66. AnimationData['Bar_g_axe_32kata_b2'] = 8.0
  67. AnimationData['Bar_g_axe30'] = 34.0
  68. AnimationData['Bar_g_axe28'] = 1.0
  69. AnimationData['Bar_g2h_d_r'] = 2.0
  70. AnimationData['Bar_g2h_d_l'] = 2.0
  71. AnimationData['Bar_g_d_r_axe'] = 2.0
  72. AnimationData['Bar_g_d_l_axe'] = 2.0
  73. AnimationData['Bar_g2h_back'] = 2.0
  74. AnimationData['Bar_g_punch1'] = 2.0
  75. AnimationData['Bar_g_punch2'] = 2.0
  76. AnimationData['Bar_g_punch3'] = 2.0
  77. AnimationData['Bar_g_punch4'] = 2.0
  78. AnimationData['Bar_g_kick'] = 2.0
  79. AnimationData['Bar_g_magic'] = 37.5
  80. AnimationData['Bar_g_magic2'] = 21.0
  81. AnimationData['Bar_g_07'] = 1.0
  82. AnimationData['Bar_g_11'] = 1.3
  83. AnimationData['Bar_g_16'] = 1.4
  84. AnimationData['Bar_g_17'] = 1.2
  85. AnimationData['Bar_g_18'] = 1.2
  86. AnimationData['Bar_g_06lowkata_new'] = 10.0
  87. AnimationData['Kgt_g_08_new'] = 1.0
  88. AnimationData['Kgt_g_01_7_new'] = 1.5
  89. AnimationData['Kgt_g_07_new'] = 1.0
  90. AnimationData['Kgt_g_s3_new'] = 2.8
  91. AnimationData['Kgt_g_12_new'] = 1.0
  92. AnimationData['Kgt_g_02_new'] = 2.0
  93. AnimationData['Kgt_g_b06_new'] = 1.0
  94. AnimationData['Kgt_g_19_bs1_new'] = 2.3
  95. AnimationData['Kgt_g_01low_new'] = 1.0
  96. AnimationData['Kgt_g_22lowkata_new'] = 2.5
  97. AnimationData['Kgt_g_28new'] = 7.5
  98. AnimationData['Kgt_g_01_new'] = 13.0
  99. AnimationData['Kgt_g_27kata_new'] = 10.0
  100. AnimationData['Kgt_g_32_5_3new'] = 8.5
  101. AnimationData['Kgt_g_21_6_s8new'] = 9.0
  102. AnimationData['Kgt_g_s22low_new'] = 10.0
  103. AnimationData['Kgt_g_sb25_new'] = 10.0
  104. AnimationData['Kgt_g_s19_new'] = 11.0
  105. AnimationData['Kgt_g_18_11_22_new'] = 10.0
  106. AnimationData['Kgt_g_b32kata_new'] = 10.0
  107. AnimationData['Kgt_g_22kata_23_new'] = 8.0
  108. AnimationData['Kgt_g_09_07_s6low_new'] = 9.0
  109. AnimationData['Kgt_g_29_3new'] = 9.0
  110. AnimationData['Kgt_g_06lowkata_new'] = 10.0
  111. AnimationData['Kgt_g_12_7_s1new'] = 70.0
  112. AnimationData['Kgt_g_s28kata_new'] = 30.0
  113. AnimationData['Kgt_g_3s9_6new'] = 3.5
  114. AnimationData['Kgt_g_back'] = 1.8
  115. AnimationData['Kgt_g_bad_axe'] = 1.6
  116. AnimationData['Kgt_g_bad_sword'] = 1.0
  117. AnimationData['Kgt_g_bad_sword2'] = 1.3
  118. AnimationData['Kgt_g_bad_sword3'] = 1.5
  119. AnimationData['Kgt_g_bad_spear'] = 1.9
  120. AnimationData['Kgt_g_bad_spear2'] = 1.9
  121. AnimationData['Kgt_g_punch1'] = 1.2
  122. AnimationData['Kgt_g_punch2'] = 1.2
  123. AnimationData['Kgt_g_kick'] = 1.2
  124. AnimationData['Kgt_g_d_r'] = 1.2
  125. AnimationData['Kgt_g_d_l'] = 1.2
  126. AnimationData['Kgt_g_magic'] = 37.5
  127. AnimationData['Kgt_g_magic2'] = 21.0
  128. AnimationData['Kgt_g_08'] = 1.0
  129. AnimationData['Kgt_g_06'] = 1.3
  130. AnimationData['Kgt_g_02'] = 1.2
  131. AnimationData['Kgt_g_07'] = 1.3
  132. AnimationData['Kgt_g_05'] = 1.2
  133. AnimationData['Amz_g_spears1'] = 1.0
  134. AnimationData['Amz_g_spear08'] = 1.0
  135. AnimationData['Amz_g_spear12'] = 1.0
  136. AnimationData['Amz_g_spears6'] = 1.0
  137. AnimationData['Amz_g_spear16low'] = 1.0
  138. AnimationData['Amz_g_spears8'] = 5.0
  139. AnimationData['Amz_g_spear_2katab6low'] = 13.0
  140. AnimationData['Amz_g_spear19'] = 10.0
  141. AnimationData['Amz_g_spear22'] = 8.6
  142. AnimationData['Amz_g_spear09'] = 8.0
  143. AnimationData['Amz_g_spear32kata_b2'] = 9.0
  144. AnimationData['Amz_g_spear_kata23'] = 9.0
  145. AnimationData['Amz_g_spear13'] = 11.0
  146. AnimationData['Amz_g_spear3s2'] = 11.0
  147. AnimationData['Amz_g_spear_21'] = 10.0
  148. AnimationData['Amz_g_spear_b29'] = 9.0
  149. AnimationData['Amz_g_spear33'] = 7.8
  150. AnimationData['Amz_g_spear_sb11'] = 9.0
  151. AnimationData['Amz_g_spear_b6_26'] = 37.0
  152. AnimationData['Amz_g_spear19_bs1'] = 65.0
  153. AnimationData['Amz_g_spear16'] = 35.0
  154. AnimationData['Amz_g_06lowkata_new'] = 10.0
  155. AnimationData['Amz_g_spear26kata'] = 2.9
  156. AnimationData['Amz_g_spear_back'] = 2.0
  157. AnimationData['Amz_g_bad_axe'] = 1.0
  158. AnimationData['Amz_g_bad_sword'] = 1.0
  159. AnimationData['Amz_g_bad_sword2'] = 1.0
  160. AnimationData['Amz_g_bad_sword3'] = 1.0
  161. AnimationData['Amz_g_09'] = 1.0
  162. AnimationData['Amz_g_05'] = 1.2
  163. AnimationData['Amz_g_02'] = 1.2
  164. AnimationData['Amz_g_06'] = 1.2
  165. AnimationData['Amz_g_07'] = 1.2
  166. AnimationData['Amz_g_magic'] = 37.5
  167. AnimationData['Amz_g_magic2'] = 21.0
  168. AnimationData['Amz_g_punch2'] = 1.0
  169. AnimationData['Amz_g_kick1'] = 1.5
  170. AnimationData['Amz_g_kick2'] = 1.0
  171. AnimationData['Amz_g_spear111'] = 1.0
  172. AnimationData['Amz_g_spear17'] = 1.0
  173. AnimationData['Amz_g_spear19_13'] = 1.0
  174. AnimationData['Amz_g_spear_b06'] = 1.0
  175. AnimationData['Amz_g_spear_bs21'] = 1.0
  176. AnimationData['Amz_g_spear02'] = 1.0
  177. AnimationData['Dwf_g_08'] = 1.0
  178. AnimationData['Dwf_g_01'] = 1.0
  179. AnimationData['Dwf_g_01low_new'] = 1.0
  180. AnimationData['Dwf_g_02'] = 1.0
  181. AnimationData['Dwf_g_05'] = 8.0
  182. AnimationData['Dwf_g_06'] = 1.0
  183. AnimationData['Dwf_g_07'] = 11.0
  184. AnimationData['Dwf_g_09'] = 38.0
  185. AnimationData['Dwf_g_01a'] = 1.0
  186. AnimationData['Dwf_g_02a'] = 1.0
  187. AnimationData['Dwf_g_05a'] = 1.0
  188. AnimationData['Dwf_g_06a'] = 1.0
  189. AnimationData['Dwf_g_07a'] = 1.0
  190. AnimationData['Dwf_g_09a'] = 1.0
  191. AnimationData['Dwf_g_18'] = 9.2
  192. AnimationData['Dwf_g_15'] = 6.0
  193. AnimationData['Dwf_g_14'] = 4.5
  194. AnimationData['Dwf_g_13'] = 10.5
  195. AnimationData['Dwf_g_16'] = 7.8
  196. AnimationData['Dwf_g_11'] = 8.0
  197. AnimationData['Dwf_g_12'] = 9.2
  198. AnimationData['Dwf_g_17'] = 9.0
  199. AnimationData['Dwf_g_21'] = 9.0
  200. AnimationData['Dwf_g_22'] = 70.0
  201. AnimationData['Dwf_g_23'] = 1.5
  202. AnimationData['Dwf_g_26'] = 1.5
  203. AnimationData['Dwf_g_27'] = 1.5
  204. AnimationData['Dwf_g_31'] = 8.0
  205. AnimationData['Dwf_g_back'] = 1.0
  206. AnimationData['Dwf_g_s18_2h'] = 1.0
  207. AnimationData['Dwf_g_32_5_3new'] = 1.0
  208. AnimationData['Dwf_g_s22low_new'] = 50.0
  209. AnimationData['Dwf_g_s3_new'] = 12.0
  210. AnimationData['Dwf_g_27kata'] = 1.0
  211. AnimationData['Dwf_g_12low'] = 1.0
  212. AnimationData['Dwf_g_s11'] = 1.0
  213. AnimationData['Dwf_g_06lowkata_new'] = 10.0
  214. AnimationData['Dwf_g_magic'] = 37.5
  215. AnimationData['Dwf_g_magic2'] = 21.0
  216. AnimationData['Dwf_g_bad_axe'] = 1.0
  217. AnimationData['Dwf_g_bad_spear'] = 1.0
  218. AnimationData['Dwf_g_bad_spear2'] = 1.0
  219. AnimationData['Dwf_g_bad_sword'] = 1.0
  220. AnimationData['Dwf_g_bad_sword1'] = 1.0
  221. AnimationData['Dwf_g_bad_sword2'] = 1.0
  222. AnimationData['Dwf_g_bad_sword3'] = 1.0
  223. AnimationData['Dwf_g_bad_no'] = 1.0
  224. AnimationData['Dwf_g_bad_1h'] = 1.0
  225. AnimationData['Dwf_g_draw_rlx'] = 1.0
  226. AnimationData['Dwf_g_draw_run'] = 1.0
  227. AnimationData['Dwf_g_d_r'] = 2.0
  228. AnimationData['Dwf_g_d_l'] = 2.0
  229. AnimationData['Dwf_g_punch1'] = 1.0
  230. AnimationData['Dwf_g_punch2'] = 1.0
  231. AnimationData['Dwf_g_kick'] = 1.0
  232. AnimationData['Ork_g_01'] = 1.0
  233. AnimationData['Ork_g_02'] = 1.0
  234. AnimationData['Ork_g_06'] = 1.0
  235. AnimationData['Ork_g_15'] = 1.2
  236. AnimationData['Ork_g_16'] = 1.5
  237. AnimationData['Ork_g_18'] = 1.8
  238. AnimationData['Gok_g_01'] = 1.0
  239. AnimationData['Gok_g_02'] = 1.2
  240. AnimationData['Gok_g_06'] = 1.3
  241. AnimationData['Gok_g_15'] = 2.0
  242. AnimationData['Gok_g_16'] = 2.5
  243. AnimationData['Gok_g_18'] = 3.0
  244. AnimationData['Skl_g_01'] = 1.0
  245. AnimationData['Skl_g_02'] = 1.2
  246. AnimationData['Skl_g_07'] = 1.3
  247. AnimationData['Skl_g_09'] = 1.5
  248. AnimationData['Skl_g_16'] = 2.1
  249. AnimationData['Skl_g_18'] = 1.8
  250. AnimationData['Skl_g_22'] = 2.0
  251. AnimationData['Lch_g_12'] = 2.8
  252. AnimationData['Lch_g_13'] = 2.8
  253. AnimationData['Lch_g_16'] = 2.8
  254. AnimationData['Lch_g_18'] = 2.8
  255. AnimationData['Zkn_g_12'] = 3.6
  256. AnimationData['Zkn_g_13'] = 3.8
  257. AnimationData['Zkn_g_16'] = 3.6
  258. AnimationData['Zkn_g_18'] = 3.7
  259. AnimationData['Tkn_g_01'] = 1.0
  260. AnimationData['Tkn_g_02'] = 1.2
  261. AnimationData['Tkn_g_07'] = 1.3
  262. AnimationData['Tkn_g_08'] = 1.4
  263. AnimationData['Tkn_g_13'] = 1.6
  264. AnimationData['Tkn_g_14'] = 2.3
  265. AnimationData['Tkn_g_16'] = 2.5
  266. AnimationData['Tkn_g_18'] = 2.6
  267. AnimationData['Dkn_g_01'] = 1.0
  268. AnimationData['Dkn_g_02'] = 1.2
  269. AnimationData['Dkn_g_07'] = 1.2
  270. AnimationData['Dkn_g_08'] = 1.3
  271. AnimationData['Dkn_g_13'] = 1.5
  272. AnimationData['Dkn_g_14'] = 1.6
  273. AnimationData['Dkn_g_16'] = 1.8
  274. AnimationData['Dkn_g_18'] = 1.95
  275. AnimationData['Rgn_g_01'] = 1.0
  276. AnimationData['Rgn_g_02'] = 1.0
  277. AnimationData['Rgn_g_03'] = 1.0
  278. AnimationData['Rgn_g_07'] = 1.0
  279. AnimationData['Rgn_g_d_r'] = 1.5
  280. AnimationData['Rgn_g_d_l'] = 1.5
  281. AnimationData['Rgn_g_escape'] = 2.5
  282. AnimationData['Rgn_g_17'] = 1.6
  283. AnimationData['Rgn_g_21'] = 1.5
  284. AnimationData['Trl_g_01'] = 1.0
  285. AnimationData['Trl_g_02'] = 1.2
  286. AnimationData['Trl_g_04'] = 1.4
  287. AnimationData['Trl_g_06'] = 1.6
  288. AnimationData['Trl_g_12'] = 2.8
  289. AnimationData['Trl_g_18'] = 3.4
  290. AnimationData['Trl_g_19'] = 1.8
  291. AnimationData['Trl_g_31'] = 4.8
  292. AnimationData['Min_g_01'] = 1.0
  293. AnimationData['Min_g_07'] = 1.2
  294. AnimationData['Min_g_08'] = 1.5
  295. AnimationData['Min_g_12'] = 3.0
  296. AnimationData['Min_g_31'] = 2.8
  297. AnimationData['Chk_g_magic'] = 15.0
  298. AnimationData['Chk_g_01'] = 1.0
  299. AnimationData['Chk_g_02'] = 1.2
  300. AnimationData['Chk_g_07'] = 1.0
  301. AnimationData['Chk_g_08'] = 1.2
  302. AnimationData['Chk_g_12'] = 2.0
  303. AnimationData['Chk_g_18'] = 2.5
  304. AnimationData['Chk_g_31'] = 4.0
  305. AnimationData['Glm_g_01'] = 15.0
  306. AnimationData['Glm_g_114'] = 20.0
  307. AnimationData['Glm_g_12'] = 20.0
  308. AnimationData['Glm_g_21'] = 10.0
  309. AnimationData['Glm_g_21_27'] = 7.0
  310. AnimationData['Glm_g_31'] = 30.0
  311. AnimationData['Glm_g_spit'] = 10.0
  312. AnimationData['Glm_g_1tw'] = 10.0
  313. AnimationData['Ldm_g_spit'] = 3.5
  314. AnimationData['Ldm_g_03'] = 1.0
  315. AnimationData['Ldm_g_06'] = 1.2
  316. AnimationData['Ldm_g_07'] = 1.3
  317. AnimationData['Ldm_g_22'] = 3.0
  318. AnimationData['Ldm_g_27'] = 2.5
  319. AnimationData['Ldm_g_jumpl'] = 1.3
  320. AnimationData['Ldm_g_jumpr'] = 1.3
  321. AnimationData['g_03'] = 0.3
  322. AnimationData['g_04'] = 0.3
  323. AnimationData['g_05'] = 0.3
  324. AnimationData['g_06'] = 0.3
  325. AnimationData['g_09'] = 0.3
  326. AnimationData['g_10'] = 1.0
  327. AnimationData['g_11'] = 1.0
  328. AnimationData['g_12'] = 1.0
  329. AnimationData['g_15'] = 1.0
  330. AnimationData['g_17'] = 1.0
  331. AnimationData['g_19'] = 1.0
  332. AnimationData['g_21'] = 2.5
  333. AnimationData['g_22'] = 2.5
  334. AnimationData['g_23'] = 2.5
  335. AnimationData['g_24'] = 2.5
  336. AnimationData['g_25'] = 2.5
  337. AnimationData['g_26'] = 2.5
  338. AnimationData['g_27'] = 2.5
  339. AnimationData['g_31'] = 3.5
  340.  
  341. def InflictFireDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  342.     fire_activated = 1
  343.     if fire_activated:
  344.         time = Bladex.GetTime()
  345.         aura = Auras.MakeAura(VictimName, 0.8, (1, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.6, 0.0, 0.6, 0.2, 0.8, 0.1, 0.0, 0.0, 0.8))
  346.         aura.Data.AddEvent(time + 0.15, (100, 1.0, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.6, 0.0, 0.6, 0.2, 0.8, 0.1, 0.0, 0.0, 0.8))
  347.         aura.Data.AddEvent(time + 0.8, (160, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.1, 0.0, 0.6, 0.2, 0.8, 0.0, 0.0, 0.0, 0.8))
  348.         prtl = Bladex.CreateEntity(aura.Name + 'Particles', 'Entity Particle System Dperson', 0, 0, 0)
  349.         prtl.PersonName = VictimName
  350.         prtl.ParticleType = 'Llamita2'
  351.         prtl.PPS = 400
  352.         prtl.Velocity = (0.0, 0.0, 0.0)
  353.         prtl.NormalVelocity = 2.0
  354.         prtl.RandomVelocity = 0.0
  355.         prtl.YGravity = -200.0
  356.         prtl.Friction = 0.02
  357.         prtl.FollowFactor = 0.0
  358.         prtl.Time2Live = 21
  359.         prtl.DeathTime = Bladex.GetTime() + 0.2
  360.         special_damage = special[1] * (1.0 - special_resistance)
  361.         if special_damage > 0:
  362.             victim = Bladex.GetEntity(VictimName)
  363.             if victim and victim.Person and victim.Data:
  364.                 victim.Data.LastDamageType = special[0]
  365.             
  366.         
  367.         return special_damage
  368.     
  369.     return 0.0
  370.  
  371.  
  372. def InflictIceDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  373.     ice_activated = 1
  374.     if ice_activated:
  375.         time = Bladex.GetTime()
  376.         aura = Auras.MakeAura(VictimName, 0.7, (1, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0))
  377.         aura.Data.AddEvent(time + 0.1, (30, 1.0, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0))
  378.         aura.Data.AddEvent(time + 0.7, (60, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.2, 0.4, 0.8, 0.6, 0.4, 0.0, 0.2, 0.8, 0.4, 0.5))
  379.         special_damage = special[1] * (1.0 - special_resistance)
  380.         if special_damage > 0:
  381.             victim = Bladex.GetEntity(VictimName)
  382.             if victim and victim.Person and victim.Data:
  383.                 victim.Data.LastDamageType = special[0]
  384.             
  385.         
  386.         return special_damage
  387.     
  388.     return 0.0
  389.  
  390.  
  391. def InflictVenomDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  392.     if Shielded:
  393.         pass
  394.     if not (effective_damage <= 0.0):
  395.         victim = Bladex.GetEntity(VictimName)
  396.         if victim and victim.Person and victim.Data:
  397.             venom_damage = special[1]
  398.             victim.Data.EnVenom(VictimName, venom_damage, AttackerName)
  399.         
  400.     
  401.     return 0
  402.  
  403.  
  404. def InflictDrainDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  405.     weapon = Bladex.GetEntity(WeaponName)
  406.     victim = Bladex.GetEntity(VictimName)
  407.     holder = Bladex.GetEntity(AttackerName)
  408.     LastDamage = min(effective_damage, victim.Life)
  409.     if weapon and victim and holder and LastDamage > 0:
  410.         holder.Life = min(holder.Life + LastDamage, CharStats.GetCharMaxLife(holder.Kind, holder.Level))
  411.         time = Bladex.GetTime()
  412.         aura = Auras.MakeAura(VictimName, 1.5, (55, 1.0, 1.0, 1, 0, 0), (), (), (2, 0.6, 0.0, 0.0, 0.5, 0.0, 0.6, 0.0, 0.0, 0.1, 0.1))
  413.         aura.Data.AddEvent(time + 1.0, (55, 0.8, 1.0, 1, 0, 0), (), (), (2, 0.6, 0.0, 0.0, 0.5, 0.0, 0.6, 0.0, 0.0, 0.1, 1.0))
  414.         aura.Data.AddEvent(time + 1.5, (255, 0.0, 1.0, 1, 0, 0), (), (), (2, 0.6, 0.0, 0.0, 0.5, 0.0, 0.6, 0.0, 0.0, 0.1, 1.0))
  415.     
  416.     return 0
  417.  
  418.  
  419. def InflictElectricDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  420.     special_damage = special[1] * (1.0 - special_resistance)
  421.     if special_damage > 0:
  422.         victim = Bladex.GetEntity(VictimName)
  423.         if victim and victim.Person and victim.Data:
  424.             victim.Data.LastDamageType = special[0]
  425.         
  426.     
  427.     return special_damage
  428.  
  429.  
  430. def InflictLightDamage(special, special_resistance, effective_damage, VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  431.     light_activated = 1
  432.     if light_activated:
  433.         time = Bladex.GetTime()
  434.         aura = Auras.MakeAura(VictimName, 0.7, (1, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0))
  435.         aura.Data.AddEvent(time + 0.1, (120, 1.0, 1.0, 0, 0, 1), (), (), (2, 0.8, 0.9, 1.0, 0.6, 0.3, 0.2, 0.6, 0.8, 0.4, 1.0))
  436.         aura.Data.AddEvent(time + 0.7, (240, 0.01, 1.0, 0, 0, 1), (), (), (2, 0.2, 0.4, 0.8, 0.6, 0.4, 0.0, 0.2, 0.8, 0.4, 0.5))
  437.         prtl = Bladex.CreateEntity(aura.Name + 'Particles', 'Entity Particle System Dperson', 0, 0, 0)
  438.         prtl.PersonName = VictimName
  439.         prtl.ParticleType = 'BrillosBladeSword'
  440.         prtl.PPS = 200
  441.         prtl.Velocity = (0.0, 0.0, 0.0)
  442.         prtl.NormalVelocity = 5.0
  443.         prtl.RandomVelocity = 0.0
  444.         prtl.YGravity = 0.0
  445.         prtl.Friction = 0.01
  446.         prtl.FollowFactor = 0.0
  447.         prtl.Time2Live = 8
  448.         prtl.DeathTime = Bladex.GetTime() + 0.4
  449.         special_damage = special[1] * (1.0 - special_resistance)
  450.         if special_damage > 0:
  451.             victim = Bladex.GetEntity(VictimName)
  452.             if victim and victim.Person and victim.Data:
  453.                 victim.Data.LastDamageType = special[0]
  454.             
  455.         
  456.         return special_damage
  457.     
  458.     return 0.0
  459.  
  460. SpecialDamageFuncs = { }
  461. SpecialDamageFuncs['Fire'] = InflictFireDamage
  462. SpecialDamageFuncs['Ice'] = InflictIceDamage
  463. SpecialDamageFuncs['Venom'] = InflictVenomDamage
  464. SpecialDamageFuncs['Drain'] = InflictDrainDamage
  465. SpecialDamageFuncs['Electric'] = InflictElectricDamage
  466. SpecialDamageFuncs['Light'] = InflictLightDamage
  467.  
  468. def DropInvalidObjectsOnImpact(EntityName):
  469.     me = Bladex.GetEntity(EntityName)
  470.     if me:
  471.         Actions.UnGraspString(EntityName, 'UnGraspString')
  472.         Actions.Stop_Weapon(EntityName, 'Stop_Weapon')
  473.         if me.InvRight:
  474.             right_type = Reference.GiveObjectFlag(me.InvRight)
  475.             if right_type == Reference.OBJ_ITEM and right_type == Reference.OBJ_SHIELD and right_type == Reference.OBJ_QUIVER and right_type == Reference.OBJ_BOW and right_type == Reference.OBJ_KEY and right_type == Reference.OBJ_SPECIALKEY and right_type == Reference.OBJ_USEME and right_type == Reference.OBJ_SPECIALKEY or right_type == Reference.OBJ_TABLET:
  476.                 Actions.DropReleaseEventHandler(EntityName, 'DropRightEvent')
  477.             
  478.         
  479.         if me.InvLeft:
  480.             left_type = Reference.GiveObjectFlag(me.InvLeft)
  481.             if not left_type == Reference.OBJ_ITEM:
  482.                 if not left_type == Reference.OBJ_WEAPON and me.InvRight != me.InvLeft:
  483.                     if left_type == Reference.OBJ_STANDARD and me.InvRight != me.InvLeft and left_type == Reference.OBJ_QUIVER and left_type == Reference.OBJ_KEY and left_type == Reference.OBJ_SPECIALKEY and left_type == Reference.OBJ_USEME and left_type == Reference.OBJ_SPECIALKEY or left_type == Reference.OBJ_TABLET:
  484.                         Actions.DropReleaseEventHandler(EntityName, 'DropLeftEvent')
  485.                     
  486.                 
  487.             
  488.  
  489.  
  490. def BreakMyShield(EntityName):
  491.     me = Bladex.GetEntity(EntityName)
  492.     if me.InvLeft != '':
  493.         if Breakings.ExplodeSpecialObject(me.InvLeft, 24000.0) == 1:
  494.             if Reference.EntitiesObjectData.has_key(me.InvLeft):
  495.                 del Reference.EntitiesObjectData[me.InvLeft]
  496.             
  497.             DropInvalidObjectsOnImpact(EntityName)
  498.             me.Wuea = Reference.WUEA_ENDED
  499.             me.LaunchAnmType('df_s_broken')
  500.             inv = me.GetInventory()
  501.             inv.RemoveShield(me.InvLeft)
  502.             inv.LinkLeftHand('None')
  503.             if me.Data.NPC:
  504.                 me.Data.ResetCombat(EntityName)
  505.             
  506.         
  507.     
  508.  
  509.  
  510. def BreakMySword(EntityName):
  511.     me = Bladex.GetEntity(EntityName)
  512.     if me.InvRight != '':
  513.         Actions.Stop_Weapon(EntityName, 'Stop_Weapon')
  514.         if Breakings.ExplodeSpecialObject(me.InvRight, 24000.0) == 1:
  515.             if Reference.EntitiesObjectData.has_key(me.InvRight):
  516.                 del Reference.EntitiesObjectData[me.InvRight]
  517.             
  518.             DropInvalidObjectsOnImpact(EntityName)
  519.             me.Wuea = Reference.WUEA_ENDED
  520.             me.LaunchAnmType('sword_broken')
  521.             inv = me.GetInventory()
  522.             inv.RemoveWeapon(me.InvRight)
  523.             inv.LinkRightHand('None')
  524.             if me.Data.NPC:
  525.                 me.Data.ResetCombat(EntityName)
  526.             
  527.         
  528.     
  529.  
  530.  
  531. def StuckWeaponFall(WeaponName, TargetName):
  532.     weapon = Bladex.GetEntity(WeaponName)
  533.     if weapon:
  534.         if weapon.Parent == TargetName:
  535.             target = Bladex.GetEntity(TargetName)
  536.             if target:
  537.                 target.Unlink(weapon)
  538.                 if target.Person:
  539.                     weapon.ExcludeHitFor(target)
  540.                 elif target.Parent:
  541.                     parent = Bladex.GetEntity(target.Parent)
  542.                     if parent and parent.Person:
  543.                         weapon.ExcludeHitFor(parent)
  544.                     
  545.                 
  546.                 weapon.Impulse(0.0, 1.0, 0.0)
  547.             
  548.         
  549.     
  550.  
  551.  
  552. def CalculateFatigue(EntityName, AnimName):
  553.     me = Bladex.GetEntity(EntityName)
  554.     if me:
  555.         current_energy = me.Energy
  556.         if current_energy > 0.0:
  557.             charF = 0
  558.             animF = 1.0
  559.             weaponF = 0
  560.             weaponData = None
  561.             WeaponName = me.GetInventory().GetActiveWeapon()
  562.             if not not WeaponName:
  563.                 if WeaponName == EntityName and AnimName == 'g_draw_rlx' or AnimName == 'g_draw_run':
  564.                     WeaponName = me.InvRightBack
  565.                 
  566.             if WeaponName:
  567.                 if Reference.EntitiesObjectData.has_key(WeaponName):
  568.                     if Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_WEAPON or Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_STANDARD:
  569.                         weaponData = Reference.EntitiesObjectData[WeaponName]
  570.                         if len(weaponData) > 1:
  571.                             weaponF = weaponData[1]
  572.                         
  573.                     
  574.                 else:
  575.                     weapon = Bladex.GetEntity(WeaponName)
  576.                     if weapon:
  577.                         kind = weapon.Kind
  578.                         if Reference.DefaultObjectData.has_key(kind):
  579.                             if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON or Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD:
  580.                                 weaponData = Reference.DefaultObjectData[kind]
  581.                                 if len(weaponData) > 1:
  582.                                     weaponF = weaponData[1]
  583.                                 
  584.                             
  585.                         
  586.                     
  587.             
  588.             if netgame.GetNetState() == 0:
  589.                 charF = CharStats.GetCharDamageData(me.CharType, me.Level)
  590.             else:
  591.                 charF = NetWeapon.GetDamage(me.CharType, me.Data.NetLevel)
  592.             me.LaunchAnimation(AnimName)
  593.             if AnimationData.has_key(me.AnimFullName):
  594.                 animF = AnimationData[me.AnimFullName]
  595.             elif AnimationData.has_key(me.AnimName):
  596.                 animF = AnimationData[me.AnimName]
  597.             
  598.             lvl = me.Level + 1
  599.             energy_cost = max((charF + weaponF) * animF, 0.0) + me.Data.Energy2Lose
  600.             max_energy = CharStats.GetCharMaxEnergy(me.Kind, me.Level)
  601.             me.Data.LoseEnergyRate = 0.0
  602.             if PrintFatigue:
  603.                 print 'energy_cost= (charF(' + `charF` + ') + weaponF(' + `weaponF` + ')) * (animF(' + me.AnimFullName + '=' + `animF` + ') + prev_energy2lose(' + `me.Data.Energy2Lose` + ')= ' + `energy_cost`
  604.                 print 'max_energy= ' + `max_energy` + ', current_energy= ' + `me.Energy`
  605.             
  606.             if energy_cost < max_energy:
  607.                 me.Data.Energy2Lose = energy_cost
  608.                 if energy_cost > me.Energy:
  609.                     weapon = Bladex.GetEntity(me.GetInventory().GetActiveWeapon())
  610.                     if weapon and not (weapon.Person):
  611.                         weapon_flag = Reference.GiveWeaponFlag(WeaponName)
  612.                         if weapon_flag == Reference.W_FLAG_2W:
  613.                             clumsy_anm = 'g_bad_sword'
  614.                         elif weapon_flag == Reference.W_FLAG_AXE:
  615.                             clumsy_anm = 'g_bad_axe'
  616.                         elif weapon_flag == Reference.W_FLAG_SP:
  617.                             clumsy_anm = 'g_bad_spear'
  618.                         else:
  619.                             clumsy_anm = 'g_bad_1h'
  620.                     else:
  621.                         clumsy_anm = 'g_bad_no'
  622.                     me.Wuea = Reference.WUEA_ENDED
  623.                     me.LaunchAnmType(clumsy_anm)
  624.                     Actions.ReportMsg('You need more energy for this attack')
  625.                 
  626.                 
  627.                 try:
  628.                     anim_duration = Bladex.GetAnimationDuration(me.AnimFullName)
  629.                 except RuntimeError:
  630.                     print me.AnimFullName + ' has not been defined for character ' + me.Kind
  631.                     anim_duration = 0.3
  632.  
  633.                 if anim_duration > 0.0:
  634.                     me.Data.LoseEnergyRate = energy_cost / anim_duration
  635.                 else:
  636.                     me.Data.LoseEnergyRate = 0.0
  637.                 return 1
  638.             else:
  639.                 Actions.ReportMsg('You need more energy for this attack')
  640.                 me.Wuea = Reference.WUEA_ENDED
  641.         
  642.         me.InterruptCombat()
  643.         me.RaiseEvent('Interrupt')
  644.         return 1
  645.     
  646.     return 0
  647.  
  648.  
  649. def CheckRightHandToDrop(EntityName):
  650.     me = Bladex.GetEntity(EntityName)
  651.     if not (me.InvRight):
  652.         return None
  653.     
  654.     two_handed_on_right = 0
  655.     if Actions.IsRightHandWeaponObject(EntityName):
  656.         w_flag = Reference.GiveWeaponFlag(me.InvRight)
  657.         if w_flag != Reference.W_FLAG_1H:
  658.             two_handed_on_right = 1
  659.         
  660.     
  661.     special_to_drop = 0
  662.     flag = Reference.GiveObjectFlag(me.InvRight)
  663.     if flag == Reference.OBJ_KEY and flag == Reference.OBJ_SPECIALKEY or flag == Reference.OBJ_USEME:
  664.         print 'right 2 drop'
  665.         special_to_drop = 1
  666.     
  667.     if special_to_drop == 1 and two_handed_on_right and me.InvLeft and me.InvRight != me.InvLeft:
  668.         if Actions.TryDropRight(EntityName):
  669.             Actions.DropReleaseEventHandler(EntityName, 'DropRightEvent')
  670.             if me.InvRight:
  671.                 return FALSE
  672.             
  673.         
  674.     
  675.  
  676.  
  677. def CalculateDamage(VictimName, AttackerName, WeaponName, DamageType, DamageZone, DamageNode, x, y, z, Shielded):
  678.     CheckRightHandToDrop(VictimName)
  679.     charF = 0
  680.     animF = 1.0
  681.     weaponF = 0
  682.     randomF = 0
  683.     throwF = 0
  684.     shieldF = 0
  685.     bowF = 0
  686.     locationF = 1.0
  687.     magicF = 1.0
  688.     thrown_flag = 0
  689.     weaponData = None
  690.     if WeaponName:
  691.         if Reference.EntitiesObjectData.has_key(WeaponName):
  692.             if Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_WEAPON and Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_STANDARD or Reference.EntitiesObjectData[WeaponName][0] == Reference.OBJ_ARROW:
  693.                 weaponData = Reference.EntitiesObjectData[WeaponName]
  694.                 if len(weaponData) > 1:
  695.                     weaponF = weaponData[1]
  696.                 
  697.             
  698.         else:
  699.             kind = Bladex.GetEntity(WeaponName).Kind
  700.             if Reference.DefaultObjectData.has_key(kind):
  701.                 if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON and Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD or Reference.DefaultObjectData[kind][0] == Reference.OBJ_ARROW:
  702.                     weaponData = Reference.DefaultObjectData[kind]
  703.                     if len(weaponData) > 1:
  704.                         weaponF = weaponData[1]
  705.                     
  706.                 
  707.             
  708.         if not AttackerName and weaponData and len(weaponData) > 2:
  709.             if PrintFormula == 1:
  710.                 print 'Possible thrown weapon'
  711.             
  712.             weapon = Bladex.GetEntity(WeaponName)
  713.             if weapon:
  714.                 
  715.                 try:
  716.                     if weapon.Data and weapon.Data.ThrownBy:
  717.                         AttackerName = weapon.Data.ThrownBy.Name
  718.                         thrown_flag = 1
  719.                         if len(weaponData) > 3:
  720.                             throwF = weaponData[3]
  721.                         
  722.                 except AttributeError:
  723.                     if weapon.Arrow:
  724.                         thrown_flag = 1
  725.                         if len(weaponData) > 3:
  726.                             throwF = weaponData[3]
  727.                         
  728.                     
  729.                 except:
  730.                     weapon.Arrow
  731.  
  732.                 
  733.                 try:
  734.                     if weapon.Person:
  735.                         AttackerName = WeaponName
  736.                 except:
  737.                     pass
  738.  
  739.             
  740.         
  741.     
  742.     attacker = None
  743.     if AttackerName:
  744.         attacker = Bladex.GetEntity(AttackerName)
  745.         if attacker and attacker.Person:
  746.             magicF = attacker.Data.FAttack
  747.             if DamageType == 'Impale' and DamageType == 'Slash' or DamageType == 'Crush':
  748.                 if netgame.GetNetState() == 0:
  749.                     charF = CharStats.GetCharDamageData(attacker.CharType, attacker.Level)
  750.                 else:
  751.                     charF = NetWeapon.GetDamage(attacker.CharType, attacker.Data.NetLevel)
  752.             
  753.             if not thrown_flag:
  754.                 if AnimationData.has_key(attacker.AnimFullName):
  755.                     animF = AnimationData[attacker.AnimFullName]
  756.                     if InflictDamageFXData.has_key(attacker.AnimFullName):
  757.                         (aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch) = InflictDamageFXData[attacker.AnimFullName]
  758.                         GenFX.InflictDamageFX(VictimName, aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch)
  759.                     
  760.                 elif AnimationData.has_key(attacker.AnimName):
  761.                     animF = AnimationData[attacker.AnimName]
  762.                     if InflictDamageFXData.has_key(attacker.AnimFullName):
  763.                         (aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch) = InflictDamageFXData[attacker.AnimFullName]
  764.                         GenFX.InflictDamageFX(VictimName, aura_size_var, aura_exp_time, r, g, b, light_intensity, sound, volume, pitch)
  765.                     
  766.                 
  767.             
  768.         
  769.     
  770.     randomF = round(whrandom.uniform(-0.05, 0.05) * charF)
  771.     charF = max(charF + randomF, 0)
  772.     if DamageZone == Reference.BODY_HEAD and DamageType == 'Impale' and thrown_flag and weaponData[0] == Reference.OBJ_ARROW:
  773.         locationF = 4.0
  774.     
  775.     if AttackerName:
  776.         shieldName = attacker.GetInventory().GetActiveShield()
  777.         if shieldName and not thrown_flag:
  778.             if Reference.EntitiesObjectData.has_key(shieldName):
  779.                 if Reference.EntitiesObjectData[shieldName][0] == Reference.OBJ_SHIELD:
  780.                     shieldF = Reference.EntitiesObjectData[shieldName][1]
  781.                 
  782.             else:
  783.                 kind = Bladex.GetEntity(shieldName).Kind
  784.                 if Reference.DefaultObjectData.has_key(kind):
  785.                     if Reference.DefaultObjectData[kind][0] == Reference.OBJ_SHIELD:
  786.                         shieldF = Reference.DefaultObjectData[kind][1]
  787.                     
  788.                 
  789.         
  790.     
  791.     if AttackerName and attacker and attacker.GetInventory().HoldingBow and thrown_flag:
  792.         if Reference.EntitiesObjectData.has_key(attacker.InvLeft):
  793.             if Reference.EntitiesObjectData[attacker.InvLeft][0] == Reference.OBJ_BOW:
  794.                 bowF = Reference.EntitiesObjectData[attacker.InvLeft][1]
  795.             
  796.         else:
  797.             kind = Bladex.GetEntity(attacker.InvLeft).Kind
  798.             if Reference.DefaultObjectData.has_key(kind):
  799.                 if Reference.DefaultObjectData[kind][0] == Reference.OBJ_BOW:
  800.                     bowF = Reference.DefaultObjectData[kind][1]
  801.                 
  802.             
  803.     
  804.     if AttackerName and attacker and attacker.Person:
  805.         lvl = attacker.Level + 1
  806.     else:
  807.         lvl = 0
  808.     basic_damage = (charF * magicF * locationF + weaponF + throwF + bowF + shieldF) * animF
  809.     basic_damage = max(basic_damage, 0)
  810.     if PrintFormula == 1:
  811.         print 'Basic Damage Formula= ((charF * magicF * locationF) + weaponF + throwF + bowF + shieldF) * animF'
  812.         print 'Basic Damage = (( ' + `charF` + ' * ' + `magicF` + ' * ' + `locationF` + ' ) + ' + `weaponF` + ' + ' + `throwF` + ' + ' + `bowF` + ' + ' + `shieldF` + ') * ' + `animF` + ' = ' + `basic_damage`
  813.     
  814.     me = Bladex.GetEntity(VictimName)
  815.     charF = 0
  816.     shieldF = 0
  817.     weaponF = 0
  818.     magicF = me.Data.FDefense
  819.     randomF = 0
  820.     shield_breakable = 0
  821.     victimsShieldData = None
  822.     blocking_with_weapon = 0
  823.     if Shielded:
  824.         victimsShieldName = me.GetInventory().GetActiveShield()
  825.         if victimsShieldName:
  826.             if Reference.EntitiesObjectData.has_key(victimsShieldName):
  827.                 if Reference.EntitiesObjectData[victimsShieldName][0] == Reference.OBJ_SHIELD:
  828.                     victimsShieldData = Reference.EntitiesObjectData[victimsShieldName]
  829.                     shieldF = victimsShieldData[2]
  830.                     shield_breakable = victimsShieldData[7]
  831.                 
  832.             else:
  833.                 kind = Bladex.GetEntity(victimsShieldName).Kind
  834.                 if Reference.DefaultObjectData.has_key(kind):
  835.                     if Reference.DefaultObjectData[kind][0] == Reference.OBJ_SHIELD:
  836.                         victimsShieldData = Reference.DefaultObjectData[kind]
  837.                         shieldF = Reference.DefaultObjectData[kind][2]
  838.                         shield_breakable = Reference.DefaultObjectData[kind][7]
  839.                     
  840.                 
  841.         else:
  842.             victimsWeaponName = me.InvRight
  843.             if not victimsWeaponName and victimsWeaponName == '' or victimsWeaponName == 'None':
  844.                 print 'Unexpected error in CalculateDamage'
  845.                 print 'Blocking but nothing in hands?'
  846.                 return None
  847.             
  848.             w_weapon = Bladex.GetEntity(victimsWeaponName)
  849.             w_flag = Reference.GiveObjectFlag(victimsWeaponName)
  850.             if w_flag != Reference.OBJ_WEAPON:
  851.                 print 'Error in CalculateDamage'
  852.                 print 'Blocking with an unexpected type of weapon'
  853.                 return None
  854.             
  855.             if Reference.EntitiesObjectData.has_key(victimsWeaponName):
  856.                 victimsShieldData = Reference.EntitiesObjectData[victimsWeaponName]
  857.             else:
  858.                 kind = Bladex.GetEntity(victimsWeaponName).Kind
  859.                 if Reference.DefaultObjectData.has_key(kind):
  860.                     victimsShieldData = Reference.DefaultObjectData[kind]
  861.                 
  862.             if not victimsShieldData and len(victimsShieldData[5]) < 1 or victimsShieldData[5][0] == Reference.W_FLAG_1H:
  863.                 print 'Error in CalculateDamage'
  864.                 print 'Trying to wblock with a one handed weapon!'
  865.             else:
  866.                 shieldF = victimsShieldData[5][4]
  867.                 shield_breakable = victimsShieldData[5][5]
  868.                 blocking_with_weapon = 1
  869.     
  870.     if netgame.GetNetState() == 0:
  871.         charF = CharStats.GetCharDefenseData(me.CharType, me.Level) + me.Data.armour_prot_factor
  872.     else:
  873.         charF = NetWeapon.GetDefense(me.CharType, me.Data.NetLevel)
  874.     randomF = round(whrandom.uniform(-0.05, 0.05) * charF)
  875.     charF = max(charF + randomF, 0)
  876.     victimsWeaponData = None
  877.     if me.GetInventory().HoldingBow:
  878.         victimsWeaponName = me.InvLeft
  879.     else:
  880.         victimsWeaponName = me.InvRight
  881.     if victimsWeaponName and blocking_with_weapon == 0:
  882.         if Reference.EntitiesObjectData.has_key(victimsWeaponName):
  883.             if Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_WEAPON and Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_STANDARD and Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_ARROW or Reference.EntitiesObjectData[victimsWeaponName][0] == Reference.OBJ_BOW:
  884.                 victimsWeaponData = Reference.EntitiesObjectData[victimsWeaponName]
  885.                 if len(victimsWeaponData) > 2:
  886.                     weaponF = victimsWeaponData[2]
  887.                 
  888.             
  889.         else:
  890.             kind = Bladex.GetEntity(victimsWeaponName).Kind
  891.             if Reference.DefaultObjectData.has_key(kind):
  892.                 if Reference.DefaultObjectData[kind][0] == Reference.OBJ_WEAPON and Reference.DefaultObjectData[kind][0] == Reference.OBJ_STANDARD and Reference.DefaultObjectData[kind][0] == Reference.OBJ_ARROW or Reference.DefaultObjectData[kind][0] == Reference.OBJ_BOW:
  893.                     victimsWeaponData = Reference.DefaultObjectData[kind]
  894.                     if len(victimsWeaponData) > 2:
  895.                         weaponF = victimsWeaponData[2]
  896.                     
  897.                 
  898.             
  899.     
  900.     DEF = charF * magicF + shieldF + weaponF
  901.     effective_damage = basic_damage - DEF
  902.     effective_damage = max(effective_damage, 0)
  903.     if PrintFormula == 1:
  904.         print 'Effective Damage Formula = basic_damage - (charF * magicF) - shieldF - weaponF'
  905.         print 'Effective Damage Formula = ' + `basic_damage` + ' - ( ' + `charF` + ' * ' + `magicF` + ' ) - ' + `shieldF` + ' - ' + `weaponF` + ' = ' + `effective_damage`
  906.     
  907.     if Shielded:
  908.         damage_withstood = int(max(basic_damage - DEF - shieldF, 0))
  909.         if not blocking_with_weapon:
  910.             shield = Bladex.GetEntity(me.GetInventory().GetActiveShield())
  911.             
  912.             try:
  913.                 if shield and shield_breakable:
  914.                     if victimsShieldData:
  915.                         if not Reference.EntitiesObjectData.has_key(shield.Name):
  916.                             Reference.EntitiesObjectData[shield.Name] = copy.copy(victimsShieldData)
  917.                             victimsShieldData = Reference.EntitiesObjectData[shield.Name]
  918.                         
  919.                         victimsShieldData[2] = victimsShieldData[2] - damage_withstood
  920.                         if victimsShieldData[2] <= 0.0:
  921.                             victimsShieldData[2] = 0.0
  922.                             if shield.Data.brkobjdata:
  923.                                 BreakMyShield(me.Name)
  924.                                 Shielded = 0
  925.                             
  926.                         elif attacker and attacker.InDestructorAttack == 1 and damage_withstood > shield_breakable:
  927.                             if shield.Data.brkobjdata:
  928.                                 BreakMyShield(me.Name)
  929.                                 Shielded = 0
  930.                                 if PrintFormula == 1:
  931.                                     print 'Shield Breaking in destructor attack, took: ' + `damage_withstood` + ', max: ' + `shield_breakable`
  932.                                 
  933.                             
  934.                         elif not thrown_flag and attacker and attacker.Person and attacker.GotAnmType('sw_react'):
  935.                             attacker.Wuea = Reference.WUEA_ENDED
  936.                             attacker.LaunchAnmType('sw_react')
  937.                         
  938.                     
  939.             except AttributeError:
  940.                 pass
  941.  
  942.             
  943.             try:
  944.                 if shield and shield.Data and shield.Data.AbsorbFunc:
  945.                     shield.Data.AbsorbFunc(AttackerName, WeaponName, damage_withstood)
  946.             except AttributeError:
  947.                 pass
  948.  
  949.         else:
  950.             weapon = Bladex.GetEntity(me.GetInventory().GetActiveWeapon())
  951.             
  952.             try:
  953.                 if weapon and weapon.Data.brkobjdata:
  954.                     if victimsShieldData:
  955.                         if not Reference.EntitiesObjectData.has_key(weapon.Name):
  956.                             Reference.EntitiesObjectData[weapon.Name] = copy.copy(victimsShieldData)
  957.                             victimsShieldData = Reference.EntitiesObjectData[weapon.Name]
  958.                         
  959.                         victimsShieldData[5][4] = victimsShieldData[5][4] - damage_withstood
  960.                         if victimsShieldData[5][4] <= 0.0:
  961.                             victimsShieldData[5][4] = 0.0
  962.                             if weapon.Data.brkobjdata:
  963.                                 BreakMySword(me.Name)
  964.                                 Shielded = 0
  965.                             
  966.                         elif attacker and attacker.InDestructorAttack == 1 and damage_withstood > shield_breakable:
  967.                             if weapon.Data.brkobjdata:
  968.                                 BreakMySword(me.Name)
  969.                                 Shielded = 0
  970.                                 if PrintFormula == 1:
  971.                                     print 'Weapon Breaking in destructor attack, took: ' + `damage_withstood` + ', max: ' + `shield_breakable`
  972.                                 
  973.                             
  974.                         
  975.                     
  976.             except AttributeError:
  977.                 pass
  978.  
  979.             
  980.             try:
  981.                 if weapon and weapon.Data and weapon.Data.AbsorbFunc:
  982.                     weapon.Data.AbsorbFunc(AttackerName, WeaponName, damage_withstood)
  983.             except AttributeError:
  984.                 pass
  985.  
  986.     
  987.     damage_resistance = me.Data.GetResistance(DamageType)
  988.     if damage_resistance > 0.0:
  989.         if PrintFormula == 1:
  990.             print 'Resistance to ' + DamageType + ' at ' + `damage_resistance` + ' reduces the effective_damage to ' + `effective_damage * (1.0 - damage_resistance)`
  991.         
  992.         effective_damage = effective_damage * (1.0 - damage_resistance)
  993.     
  994.     if effective_damage > 0:
  995.         me.Data.LastDamageType = DamageType
  996.     
  997.     special_damage = 0.0
  998.     if Shielded:
  999.         pass
  1000.     if not (effective_damage <= 0):
  1001.         effective_damage = effective_damage + special_damage
  1002.     
  1003.     if not Shielded:
  1004.         if (DamageType == 'Impale' or DamageType == 'Slash') and Bladex.GetBloodLevel() > 0:
  1005.             me.Data.TakeBleedingImpact = effective_damage
  1006.         else:
  1007.             me.Data.TakeBleedingImpact = 0
  1008.     prevLife = me.Life
  1009.     if not (me.Data.Invincibility):
  1010.         me.Life = me.Life - effective_damage
  1011.     
  1012.     if effective_damage > 0:
  1013.         if me.Life <= 0:
  1014.             pass
  1015.         me.Data.Mutilate = DamageType == 'Slash'
  1016.     else:
  1017.         me.Data.Mutilate = 0
  1018.         if not Shielded:
  1019.             effective_damage = 1.0
  1020.         
  1021.     if thrown_flag == 1:
  1022.         
  1023.         try:
  1024.             me.Data.Respond2Thrown(me.Name, AttackerName)
  1025.         except AttributeError:
  1026.             pass
  1027.  
  1028.     
  1029.     me.Data.RespondToHit(me.Name, AttackerName, effective_damage, DamageType, DamageZone, Shielded)
  1030.     if PlayerHitFunc != '':
  1031.         PlayerHitFunc(VictimName, AttackerName, me.Life, prevLife)
  1032.     
  1033.     if me.Life <= 0.0:
  1034.         if AttackerName:
  1035.             attacker = Bladex.GetEntity(AttackerName)
  1036.             if attacker and attacker.InDestructorAttack == 1 and effective_damage > 1:
  1037.                 
  1038.                 try:
  1039.                     if victimsShieldName:
  1040.                         victimsShield = Bladex.GetEntity(victimsShieldName)
  1041.                         if victimsShield and victimsShield.Data.brkobjdata:
  1042.                             BreakMyShield(me.Name)
  1043.                         
  1044.                 except:
  1045.                     pass
  1046.  
  1047.                 
  1048.                 try:
  1049.                     if victimsWeaponName:
  1050.                         victimsWeapon = Bladex.GetEntity(victimsWeaponName)
  1051.                         if victimsWeapon and victimsWeaponName.Data.brkobjdata:
  1052.                             BreakMySword(me.Name)
  1053.                         
  1054.                 except:
  1055.                     pass
  1056.  
  1057.             
  1058.             if prevLife > 0 and netgame.GetNetState() == 0:
  1059.                 AttackerEntity = Bladex.GetEntity(AttackerName)
  1060.                 if AttackerEntity:
  1061.                     AttackerEntity.Data.OnKilledEnemy(VictimName)
  1062.                 
  1063.             
  1064.         
  1065.     
  1066.     if thrown_flag and weapon.Arrow:
  1067.         weapon.MessageEvent(Reference.MESSAGE_STOP_WEAPON, 0, 0)
  1068.         weapon.MessageEvent(Reference.MESSAGE_STOP_TRAIL, 0, 0)
  1069.         weapon.Stop(x, y, z)
  1070.         if me and not (me.Data.Mutilate) and DamageNode != -1 and DamageZone != Reference.BODY_HEAD and me.Life > 0.0:
  1071.             me.LinkToNode(weapon, DamageNode)
  1072.             sticktime = 3.0 / weapon.Mass
  1073.             print 'object ' + weapon.Name + ' of kind ' + weapon.Kind + ' of mass ' + `weapon.Mass` + ' sticking for ' + `sticktime` + ' seconds'
  1074.             Bladex.AddScheduledFunc(Bladex.GetTime() + sticktime, StuckWeaponFall, (weapon.Name, VictimName), weapon.Name + '_StuckWeaponFall')
  1075.             if weapon.StickFunc:
  1076.                 weapon.StickFunc(weapon.Name, me.Name)
  1077.             
  1078.         else:
  1079.             weapon.Impulse(0.0, 1.0, 0.0)
  1080.     
  1081.     if me.Data.Mutilate:
  1082.         if PrintFormula == 1:
  1083.             print 'Mutilation'
  1084.         
  1085.     
  1086.     if Bladex.GetMutilationLevel() == 0:
  1087.         return 0
  1088.     else:
  1089.         return me.Data.Mutilate
  1090.  
  1091.